package com.example.demo.vo.user;

import com.example.demo.entity.user.*;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.time.LocalDateTime;

public class UserInfoVo {
    private Integer user_id;
    private String username;
    private String password;
    private String gender;
    private String email;
    private String phone;
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private LocalDateTime create_time;
    private ClassInfo classInfo;
    private Integer current_state;
    private String card_id;
    private String dorm_id;
    private String student_array;

    public Integer getUser_id() {
        return user_id;
    }

    public void setUser_id(Integer user_id) {
        this.user_id = user_id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public LocalDateTime getCreate_time() {
        return create_time;
    }

    public void setCreate_time(LocalDateTime create_time) {
        this.create_time = create_time;
    }

    public ClassInfo getClassInfo() {
        return classInfo;
    }

    public void setClassInfo(ClassInfo classInfo) {
        this.classInfo = classInfo;
    }

    public Integer getCurrent_state() {
        return current_state;
    }

    public void setCurrent_state(Integer current_state) {
        this.current_state = current_state;
    }

    public String getCard_id() {
        return card_id;
    }

    public void setCard_id(String card_id) {
        this.card_id = card_id;
    }

    public String getDorm_id() {
        return dorm_id;
    }

    public void setDorm_id(String dorm_id) {
        this.dorm_id = dorm_id;
    }

    public String getStudent_array() {
        return student_array;
    }

    public void setStudent_array(String student_array) {
        this.student_array = student_array;
    }

    public static UserInfoVo createVoByAdmin(Admin admin){
        UserInfoVo userInfoVo = new UserInfoVo();
        userInfoVo.user_id = admin.getAdmin_id();
        userInfoVo.username = admin.getUsername();
        userInfoVo.phone = admin.getPhone();
        userInfoVo.card_id = admin.getCard_id();
        userInfoVo.gender = admin.getGender();
        return  userInfoVo;
    }
    public static UserInfoVo createVoByTeacher(Teacher teacher){
        UserInfoVo userInfoVo = new UserInfoVo();
        userInfoVo.user_id = teacher.getTeacher_id();
        userInfoVo.username = teacher.getUsername();
        userInfoVo.create_time = teacher.getCreate_time();
        userInfoVo.gender = teacher.getGender();
        userInfoVo.email = teacher.getEmail();
        userInfoVo.phone = teacher.getPhone();
        userInfoVo.card_id = teacher.getCard_id();
        return  userInfoVo;
    }
    public static UserInfoVo createVoByStudent(Student student, ClassInfo classInfo){
        UserInfoVo userInfoVo = new UserInfoVo();
        userInfoVo.user_id = student.getStudent_id();
        userInfoVo.username = student.getUsername();
        userInfoVo.gender = student.getGender();
        userInfoVo.email = student.getEmail();
        userInfoVo.phone = student.getPhone();
        userInfoVo.create_time = student.getCreate_time();
        userInfoVo.setClassInfo(classInfo);
        userInfoVo.current_state = student.getCurrent_state();
        userInfoVo.card_id = student.getCard_id();
        userInfoVo.dorm_id = student.getDorm_id();
        return  userInfoVo;
    }
    public static UserInfoVo createVoByParent(Parent parent){
        UserInfoVo userInfoVo = new UserInfoVo();
        userInfoVo.user_id = parent.getParent_id();
        userInfoVo.username = parent.getUsername();
        userInfoVo.gender = parent.getGender();
        userInfoVo.student_array = parent.getStudent_array();
        return  userInfoVo;
    }
}
